 package org.edu.modules.abutment.controller;

 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.xiaoymin.knife4j.annotations.ApiSort;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import java.util.Arrays;
 import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 import org.edu.common.api.vo.Result;
 import org.edu.common.aspect.annotation.AutoLog;
 import org.edu.common.system.base.controller.BaseController;
 import org.edu.common.system.query.QueryGenerator;
 import org.edu.modules.abutment.entity.VeAddonsAbutmentReply;
 import org.edu.modules.abutment.service.IVeAddonsAbutmentReplyService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import springfox.documentation.annotations.ApiIgnore;















 @Api(tags = {"对接回复"})
 @RestController
 @RequestMapping({"/abutment/veAddonsAbutmentReply"})
 @ApiSort(210)
 public class VeAddonsAbutmentReplyController
   extends BaseController<VeAddonsAbutmentReply, IVeAddonsAbutmentReplyService>
 {
/*  52 */   private static final Logger log = LoggerFactory.getLogger(org.edu.modules.abutment.controller.VeAddonsAbutmentReplyController.class);









   @Autowired
   private IVeAddonsAbutmentReplyService veAddonsAbutmentReplyService;









   @AutoLog("对接回复-分页查询")
   @ApiOperation(value = "分页查询", notes = "对接回复-分页查询")
   @PostMapping({"/list"})
   @ApiImplicitParams({@ApiImplicitParam(name = "abutid", value = "需求对接id", required = true), @ApiImplicitParam(name = "title", value = "标题", required = false)})
   public Result<?> queryPageList(@ApiIgnore VeAddonsAbutmentReply veAddonsAbutmentReply, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
     QueryWrapper<VeAddonsAbutmentReply> queryWrapper = QueryGenerator.initQueryWrapper(veAddonsAbutmentReply, req.getParameterMap());
     Page<Map<String, Object>> page = new Page(pageNo.intValue(), pageSize.intValue());
     queryWrapper.setEntity(veAddonsAbutmentReply);
     IPage<Map<String, Object>> pageList = this.veAddonsAbutmentReplyService.pageMaps((IPage)page, (Wrapper)queryWrapper);
     return Result.OK(pageList);
   }






   @AutoLog("对接回复-通过id查询")
   @ApiOperation(value = "通过id查询", notes = "对接回复-通过id查询")
   @PostMapping({"/queryById"})
   public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
/*  94 */     VeAddonsAbutmentReply veAddonsAbutmentReply = (VeAddonsAbutmentReply)this.veAddonsAbutmentReplyService.getById(id);
     if (veAddonsAbutmentReply == null) {
       return Result.error("未找到对应数据");
     }
    return Result.OK(veAddonsAbutmentReply);
   }






   @AutoLog("对接回复-新增信息")
   @ApiOperation(value = "新增信息", notes = "对接回复-新增信息")
   @PostMapping({"/add"})
   public Result<?> add(@RequestBody VeAddonsAbutmentReply veAddonsAbutmentReply) {
    if (this.veAddonsAbutmentReplyService.save(veAddonsAbutmentReply)) {
      return Result.OK("添加成功！");
     }
    return Result.error("操作失败");
   }






   @AutoLog("对接回复-修改信息")
   @ApiOperation(value = "修改信息", notes = "对接回复-修改信息")
   @PostMapping({"/edit"})
   public Result<?> edit(@RequestBody VeAddonsAbutmentReply veAddonsAbutmentReply) {
     if (this.veAddonsAbutmentReplyService.updateById(veAddonsAbutmentReply)) {
       return Result.OK("编辑成功!");
     }
     return Result.error("操作失败");
   }


   @AutoLog("对接-对接成功")
   @PostMapping({"finish"})
   @ApiOperation(value = "对接成功", notes = "对接-对接成功")
   public Result<?> finish(@RequestParam(name = "ids", required = true) String ids) {
     if (this.veAddonsAbutmentReplyService.changeStatusByIds(ids.split(","), 1) > 0) {
       return Result.OK("操作成功!");
     }
     return Result.error("操作失败");
   }

   @AutoLog("对接-取消对接")
   @PostMapping({"cancel"})
   @ApiOperation(value = "取消对接", notes = "对接-取消对接")
   public Result<?> cancel(@RequestParam(name = "ids", required = true) String ids) {
     if (this.veAddonsAbutmentReplyService.changeStatusByIds(ids.split(","), 0) > 0) {
       return Result.OK("操作成功!");
     }
     return Result.error("操作失败");
   }






   @AutoLog("对接回复-通过id删除")
   @ApiOperation(value = "通过id删除", notes = "对接回复-通过id删除")
   @PostMapping({"/delete"})
   public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
     if (this.veAddonsAbutmentReplyService.removeById(id)) {
/* 162 */       return Result.OK("删除成功!");
     }
/* 164 */     return Result.error("操作失败");
   }






   @AutoLog("对接回复-批量删除")
   @ApiOperation(value = "批量删除", notes = "对接回复-批量删除")
   @PostMapping({"/deleteBatch"})
   public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
/* 176 */     if (this.veAddonsAbutmentReplyService.removeByIds(Arrays.asList(ids.split(",")))) {
       return Result.OK("批量删除成功!");
     }
     return Result.error("操作失败");
   }
 }


